// 可选：将高德 API 调用逻辑抽离到服务层
const axios = require('axios');

exports.fetchWeather = async (lat, lng) => {
  const url = `https://restapi.amap.com/v3/weather/weatherInfo?location=${lng},${lat}&key=${process.env.GAODE_API_KEY}&extensions=base`;
  const response = await axios.get(url);
  return response.data;
};

exports.fetchForecastWeather = async (adcode) => {
  const url = `https://restapi.amap.com/v3/weather/weatherInfo?city=${adcode}&key=${process.env.GAODE_API_KEY}&extensions=all`;
  const response = await axios.get(url);
  return response.data;
};